# Makefile  -- core Makefile

#Copyright (C) 2010 Gabriel Alises Cano, Javier Angulo Lucerón

#This file is part of Computer Graphics : Final Project 09-10.

#Computer Graphics : Final Project 09-10 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
#Computer Graphics : Final Project 09-10 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#You should have received a copy of the GNU General Public License along with Computer Graphics : Final Project 09-10.  If not, see <http://www.gnu.org/licenses/>. 

LD = g++
SRC = src/
OBJ = obj/
HEAD_CORE = include/
HEAD_DATA = ../data/
CXXFLAGS = -Wall -I $(HEAD_CORE) -I /usr/include -ggdb 
OBJS = $(OBJ)Vertex3D.o $(OBJ)Triangle.o $(OBJ)Object3D.o $(OBJ)Mesh.o $(OBJ)Util.o $(OBJ)Camera.o $(OBJ)Scene.o
TESTS = basic_test move_test scale_test rotate_test select_test extrude_test merge_test

all : dirs $(OBJS) test

test : $(TESTS)

%_test : 
	cd ./test/$@; make;

dirs :
	@ if [ ! -d obj ]; then echo "Creating dirs ..."; mkdir obj;echo "Done!"; fi;

$(OBJ)%.o : $(SRC)%.cpp
	$(CC) $(CXXFLAGS) -c $^ -o $@

clean :
	@cd ./test; make clean; 
	@echo Cleaning ...
	@rm -rf $(OBJ)
	@echo Done!
